<template lang="">
    <div class="app-container">
    <el-form :inline="true" :model="queryItem" class="demo-form-inline">
  <el-form-item label="站点">
    <el-input v-model="queryItem.siteId" placeholder="请输入站点"></el-input>
  </el-form-item>
  <!-- <el-form-item label="活动区域">
    <el-select v-model="formInline.region" placeholder="活动区域">
      <el-option label="区域一" value="shanghai"></el-option>
      <el-option label="区域二" value="beijing"></el-option>
    </el-select>
  </el-form-item> -->
  <el-form-item>
    <el-button type="primary" v-on:click="queryList">查询</el-button>
  </el-form-item>
</el-form>
    
    <el-table
    :data="tableData"
    style="width: 100%"
    :row-class-name="tableRowClassName">
    <el-table-column
      prop="pageCreateTime"
      label="日期"
      width="180"
      fixed="left"
      >
    </el-table-column>
    <el-table-column
      prop="pageName"
      label="页面名"
      width="180">
    </el-table-column>
    <el-table-column
      prop="pageAliase"
      label="别名">
    </el-table-column>
  </el-table>

  <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="currentPage"
      :page-sizes="[10, 20, 30, 40]"
      :page-size="100"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total">
    </el-pagination>
  </div>
</template>

<script>
import {page_list}  from '../api/zdcmsapi'
export default {
    methods: {
      tableRowClassName({row, rowIndex}) {
        if (rowIndex === 1) {
          return 'warning-row';
        } else if (rowIndex === 3) {
          return 'success-row';
        }
        return '';
      },
      queryList(){
        // alert(new Date())
        page_list(this.currentPage,10).then(res=>{
          let dataList = res.queryResult.list
          let total = res.queryResult.total
          this.tableData = dataList
          this.total = total

        })
      },
      handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
      },
      handleCurrentChange(val) {
        console.log(`当前页: ${val}`);
        this.currentPage = val
        this.queryList()
        
      }
    },

     data() {
        return {
          queryItem:{
            siteId:null
          },
          currentPage: null,
          total: 50,
          tableData: []
        }
      },
      created() {
        // 页面创建就执行方法
        this.currentPage=1
        this.queryList()
      },
}
</script>
<style>
     .el-table .warning-row {
    background: oldlace;
  }

  .el-table .success-row {
    background: #f0f9eb;
  }
</style>